package lab03.test06;

public class Triangle {
    //三角形的三边
    double sideA,sideB,sideC,area,length;
    boolean boo;
    public Triangle(double a,double b,double c){
        sideA=a;
        sideB=b;
        sideC=c;
        if (a+b>c&&a+c>b&&b+c>a){
            boo =true;
        }
        else {
            boo =false;
        }
    }
    double getLength(){
        if (boo=true){
            length=sideA+sideC+sideB;
            return length;
        }
        else{
            System.out.println("这不是一个三角形");
            return 0;
        }
    }
    double getArea(){
        if (boo){
            double p=(sideA+sideB+sideC)/2;
            area=Math.sqrt(p*(p-sideC)*(p-sideB)*(p-sideA));
            return area;
        }
        else {
            System.out.println("这不是一个三角形");
            return 0;
        }
    }
    public void getABC(double a,double b,double c){
        sideA=a;
        sideB=b;
        sideC=c;
        if (a+b>c&&a+c>b&&b+c>a){
            boo=true;
        }
        else {
            boo=false;
        }
    }
}
